﻿function CheckAdvertAdd()
{
    var prefix = "ctl00_ContentPlaceHolder1_";
    var advertname = document.getElementById(prefix + "txtAdvertName");
    var type = document.getElementById(prefix + "ddlType");
    var advertorderid = document.getElementById(prefix + "ddlAdvertOrderID");
    var image = document.getElementById(prefix + "FileUpload1");
    var begindate = document.getElementById(prefix + "txtBeginDate");
    var enddate = document.getElementById(prefix + "txtEndDate");
    var totalprice = document.getElementById(prefix + "txtTotalPrice");

    if (advertname.value.length == 0)
    {
        alert("请输入广告名称！");
        advertname.focus();
        return false;
    }
    if (advertorderid.value == "-1")
    {
        alert("请选择广告位！");
        advertorderid.focus();
        return false;
    }
    if (type.value == "1")
    {
        if (image.value.length == 0)
        {
            alert("请上传广告图片！");
            return false;
        }
    }
    if (begindate.value.length == 0)
    {
        alert("请输入开始日期！");
        begindate.focus();
        return false;
    }
    if (enddate.value.length == 0)
    {
        alert("请输入结束日期！");
        enddate.focus();
        return false;
    }
    if (totalprice.value.length == 0)
    {
        alert("请输入价格！");
        totalprice.focus();
        return false;
    }
    if (!is_numeric(totalprice.value))
    {
        alert("价格格式不正确！");
        totalprice.focus();
        return false;
    }

    return true;
}


function CheckAdvertEdit()
{
    var prefix = "ctl00_ContentPlaceHolder1_";
    var advertname = document.getElementById(prefix + "txtAdvertName");
    var type = document.getElementById(prefix + "ddlType");
    var advertorderid = document.getElementById(prefix + "ddlAdvertOrderID");
    var begindate = document.getElementById(prefix + "txtBeginDate");
    var enddate = document.getElementById(prefix + "txtEndDate");
    var totalprice = document.getElementById(prefix + "txtTotalPrice");

    if (advertname.value.length == 0)
    {
        alert("请输入广告名称！");
        advertname.focus();
        return false;
    }
    if (advertorderid.value == "-1")
    {
        alert("请选择广告位！");
        advertorderid.focus();
        return false;
    }
    if (begindate.value.length == 0)
    {
        alert("请输入开始日期！");
        begindate.focus();
        return false;
    }
    if (enddate.value.length == 0)
    {
        alert("请输入结束日期！");
        enddate.focus();
        return false;
    }
    if (totalprice.value.length == 0)
    {
        alert("请输入价格！");
        totalprice.focus();
        return false;
    }
    if (!is_numeric(totalprice.value))
    {
        alert("价格格式不正确！");
        totalprice.focus();
        return false;
    }

    return true;
}